package com.lyz.dz.des.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.lyz.dz.des.config.ValidationGroups;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 轮播表
 * </p>
 *
 * @author <a href="https://fengwenyi.com">Erwin Feng</a>
 * @since 2021-08-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("banner")
@AllArgsConstructor
@NoArgsConstructor
public class BannerEntity extends Model<BannerEntity> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO )
    @TableField(whereStrategy = FieldStrategy.NOT_EMPTY)
    private Integer id;

    /**
     * 联关用户表
     */
    @TableField( whereStrategy =FieldStrategy.NOT_EMPTY)
//    @TableField("user_id")
    private Integer userId;

    /**
     * 题标
     */
    @NotBlank(message = "title不能为空",groups = {ValidationGroups.Save.class})
    @TableField(condition = SqlCondition.LIKE,whereStrategy =FieldStrategy.NOT_EMPTY)
    private String title;

    /**
     * 片图
     */

    @NotNull(message = "position 不能为空",groups = {ValidationGroups.Save.class})
    @TableField(condition = SqlCondition.LIKE,whereStrategy =FieldStrategy.NOT_EMPTY)
    private String image;

    @NotNull(message = "orderStatus 不能为空",groups = {ValidationGroups.Save.class})
    @TableField(condition = SqlCondition.LIKE,whereStrategy =FieldStrategy.NOT_EMPTY)
    private Integer orderStatus;

    /**
     * 否是有效，1有效，0无效
     */


    @NotNull(message = "isEffect 不能为空",groups = {ValidationGroups.Save.class})
    @TableField(condition = SqlCondition.LIKE,whereStrategy =FieldStrategy.NOT_EMPTY)
    private Integer isEffect;

    /**
     * 立建时间
     */
    @TableField(condition = SqlCondition.LIKE,whereStrategy =FieldStrategy.NOT_EMPTY)
    private LocalDateTime createTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
